// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2017, 2020, The Linux Foundation. All rights reserved.
 */

#include <linux/types.h>
#include "msm_sdw.h"

const u8 msm_sdw_page_map[MSM_SDW_MAX_REGISTER] = {
	[MSM_SDW_TX9_SPKR_PROT_PATH_CTL] = 0xa,
	[MSM_SDW_TX9_SPKR_PROT_PATH_CFG0] = 0xa,
	[MSM_SDW_TX10_SPKR_PROT_PATH_CTL] = 0xa,
	[MSM_SDW_TX10_SPKR_PROT_PATH_CFG0] = 0xa,
	[MSM_SDW_TX11_SPKR_PROT_PATH_CTL] = 0xa,
	[MSM_SDW_TX11_SPKR_PROT_PATH_CFG0] = 0xa,
	[MSM_SDW_TX12_SPKR_PROT_PATH_CTL] = 0xa,
	[MSM_SDW_TX12_SPKR_PROT_PATH_CFG0] = 0xa,
	[MSM_SDW_COMPANDER7_CTL0] = 0xb,
	[MSM_SDW_COMPANDER7_CTL1] = 0xb,
	[MSM_SDW_COMPANDER7_CTL2] = 0xb,
	[MSM_SDW_COMPANDER7_CTL3] = 0xb,
	[MSM_SDW_COMPANDER7_CTL4] = 0xb,
	[MSM_SDW_COMPANDER7_CTL5] = 0xb,
	[MSM_SDW_COMPANDER7_CTL6] = 0xb,
	[MSM_SDW_COMPANDER7_CTL7] = 0xb,
	[MSM_SDW_COMPANDER8_CTL0] = 0xb,
	[MSM_SDW_COMPANDER8_CTL1] = 0xb,
	[MSM_SDW_COMPANDER8_CTL2] = 0xb,
	[MSM_SDW_COMPANDER8_CTL3] = 0xb,
	[MSM_SDW_COMPANDER8_CTL4] = 0xb,
	[MSM_SDW_COMPANDER8_CTL5] = 0xb,
	[MSM_SDW_COMPANDER8_CTL6] = 0xb,
	[MSM_SDW_COMPANDER8_CTL7] = 0xb,
	[MSM_SDW_RX7_RX_PATH_CTL] = 0xb,
	[MSM_SDW_RX7_RX_PATH_CFG0] = 0xb,
	[MSM_SDW_RX7_RX_PATH_CFG1] = 0xb,
	[MSM_SDW_RX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_FS_CNT_CONTROL] = 0xd,
	[MSM_SDW_CLK_RST_CTRL_SWR_CONTROL] = 0xd,
	[MSM_SDW_TOP_TOP_CFG0] = 0xd,
	[MSM_SDW_TOP_TOP_CFG1] = 0xd,
	[MSM_SDW_TOP_RX_I2S_CTL] = 0xd,
	[MSM_SDW_TOP_TX_I2S_CTL] = 0xd,
	[MSM_SDW_TOP_I2S_CLK] = 0xd,
	[MSM_SDW_TOP_RX7_PATH_INPUT0_MUX] = 0xd,
	[MSM_SDW_TOP_RX7_PATH_INPUT1_MUX] = 0xd,
	[MSM_SDW_TOP_RX8_PATH_INPUT0_MUX] = 0xd,
	[MSM_SDW_TOP_RX8_PATH_INPUT1_MUX] = 0xd,
	[MSM_SDW_TOP_FREQ_MCLK] = 0xd,
	[MSM_SDW_TOP_DEBUG_BUS_SEL] = 0xd,
	[MSM_SDW_TOP_DEBUG_EN] = 0xd,
	[MSM_SDW_TOP_I2S_RESET] = 0xd,
	[MSM_SDW_TOP_BLOCKS_RESET] = 0xd,
};

const u8 msm_sdw_reg_readable[MSM_SDW_MAX_REGISTER] = {
	[MSM_SDW_PAGE_REGISTER] = 1,
	[MSM_SDW_TX9_SPKR_PROT_PATH_CTL] = 1,
	[MSM_SDW_TX9_SPKR_PROT_PATH_CFG0] = 1,
	[MSM_SDW_TX10_SPKR_PROT_PATH_CTL] = 1,
	[MSM_SDW_TX10_SPKR_PROT_PATH_CFG0] = 1,
	[MSM_SDW_TX11_SPKR_PROT_PATH_CTL] = 1,
	[MSM_SDW_TX11_SPKR_PROT_PATH_CFG0] = 1,
	[MSM_SDW_TX12_SPKR_PROT_PATH_CTL] = 1,
	[MSM_SDW_TX12_SPKR_PROT_PATH_CFG0] = 1,
	[MSM_SDW_COMPANDER7_CTL0] = 1,
	[MSM_SDW_COMPANDER7_CTL1] = 1,
	[MSM_SDW_COMPANDER7_CTL2] = 1,
	[MSM_SDW_COMPANDER7_CTL3] = 1,
	[MSM_SDW_COMPANDER7_CTL4] = 1,
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